package com.it.gw.modules.station

import android.content.Intent
import com.it.gw.R
import com.it.gw.base.BaseActivity
import com.it.gw.databinding.ActivityGwManagerBinding
import com.it.gw.modules.station.activity.EquipmentFailureStatisticsActivity
import com.it.gw.modules.station.activity.GQStationListActivity
import com.it.gw.modules.station.activity.GQStationRecordActivity
import com.it.gw.modules.station.activity.GWRunningStatisticsActivity
import com.it.gw.modules.station.activity.MyWorkOrderActivity
import com.it.gw.modules.station.activity.QualTypeStatisticsActivity

class GwManagerActivity : BaseActivity<ActivityGwManagerBinding>() {
    override fun initObserver() {
        gqStationViewModel.myWorkOrderVoListLiveData.observe(this) {
            if (it.result) {
                binding.count.setText("${it.data?.total}")
            }

        }
    }

    override fun initListener() {
        binding.ll1.setOnClickListener {
            val intent = Intent(this, GQStationListActivity::class.java)
            startActivity(intent)
        }
        binding.ll2.setOnClickListener {
            val intent = Intent(this, GQStationRecordActivity::class.java)
            startActivity(intent)
        }
        binding.ll3.setOnClickListener {
            val intent = Intent(this, MyWorkOrderActivity::class.java)
            startActivity(intent)
        }
        binding.ll4.setOnClickListener {
            val intent = Intent(this, GWRunningStatisticsActivity::class.java)
            startActivity(intent)
        }
        binding.ll5.setOnClickListener {
            val intent = Intent(this, QualTypeStatisticsActivity::class.java)
            startActivity(intent)
        }
        binding.ll6.setOnClickListener {
            val intent = Intent(this, EquipmentFailureStatisticsActivity::class.java)
            startActivity(intent)
        }


    }

    override fun initData() {

    }

    override fun onResume() {
        super.onResume()
        //获取我的工单数量
        gqStationViewModel.getListByUserId(
            1,
            1,
            status = "0",
        )
    }

    override fun initView() {
        setTitle(
            title = R.string.str_gw_manager,
            isBack = true

        )
    }

    override fun setContentView() {
        binding = ActivityGwManagerBinding.inflate(layoutInflater)
        setContentView(binding.root)
    }
}